define(function (require) {
    var app = require('app')
    .controller('bookCtrl', ['$scope','$rootScope', function($scope,$rootScope){

        // 保存时，添加一个当前地图范围参数
    	$scope.bookSave = function(fn,r){
    		var go = $rootScope.gisObject;
			if(go.is2D){
				r.bookextent = $rootScope.getMapExtent();
			}else{
				r.bookextent = $rootScope.getCesiumExtent();
			}
    		$rootScope.save(fn,r);
    		return true;
    	};

    	// 缩放到
		$scope.extentTo = function(e){
			var wkid = 0;
			var go = $rootScope.gisObject;
			if(go.mapisdlwkid){
				wkid = go.dlwkid;
			}else{
				wkid = go.tywkid;
			}
			var extent = $rootScope.getExtentByString(e, wkid);

			var go = $rootScope.gisObject;
			if(go.is2D){
				go.map.setExtent(extent);
			}else{
				$rootScope.setCesiumExtent(extent);
			}
		};

	}]);
});